import { createApp } from "vue";
import Antd from "ant-design-vue";
import router from "./router";
import "ant-design-vue/dist/reset.css";

import { initVersionCheck } from "./utils/versionChecker.js";

import * as Sentry from "@sentry/vue";

async function importRem() {
  if (
    navigator.userAgent.match(
      /(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i
    )
  ) {
  } else {
    await import("../rem");
  }
}

importRem();

if (import.meta.env.PROD) {
  initVersionCheck();
}

import "./styles/iconfont.css";
import App from "./App.vue";

import components from "./components/index.js";

let app = createApp(App);

Sentry.init({
  app,
  dsn: "https://92302e071c53f78d9636c129f621d44a@o4509111764123649.ingest.us.sentry.io/4509111804362752",
  logErrors: true, // 注意：Vue在接入Sentry 之后浏览器控制台不会弹出报错，如果需要保留，需要设置logErrors 的值为 true
  environment: import.meta.env.MODE,
  tracesSampleRate: 1.0,
  tracePropagationTargets: ["http://www.sushu.online:3000/", /^\//],
  integrations: [Sentry.replayIntegration()],
  // Session Replay
  replaysSessionSampleRate: 0.1,
  replaysOnErrorSampleRate: 1.0,
});
app.use(Antd).use(components).use(router).mount("#app");
